
import BaseService from '@/api/BaseService'
class NvService extends BaseService {
  getNv (commonInfo, ndCode, nvId, callback = () => {
  }) {
    const data = {
      commonInfo: commonInfo,
      value: {
        nvId: nvId,
        ndCode: ndCode
      }
    }
    return this.remoteCall('/nv/getNv', data, callback)
  }

  getNvByCode (commonInfo, ndCode, nvCode, fdName, callback = () => {
  }) {
    const data = {
      commonInfo: commonInfo,
      value: {
        ndCode: ndCode,
        code: nvCode,
        codeFdName: fdName
      }
    }
    return this.remoteCall('/nv/getNv', data, callback)
  }

  initNv (commonInfo, ndCode, callback = () => {
  }) {
    const data = {
      commonInfo: commonInfo,
      value: ndCode
    }
    return this.remoteCall('/nv/initNv', data, callback)
  }

  saveNv (commonInfo, nv, callback = () => {
  }) {
    const data = {
      commonInfo: commonInfo,
      value: nv
    }
    return this.remoteCall('/nv/saveNv', data, callback)
  }

  saveNvs (commonInfo, nvs, callback = () => {
  }) {
    const data = {
      commonInfo: commonInfo,
      value: nvs
    }
    return this.remoteCall('/nv/saveNvs', data, callback)
  }

  commitNv (commonInfo, nv, callback = () => {
  }) {
    const data = {
      commonInfo: commonInfo,
      value: nv
    }
    return this.remoteCall('/nv/commitNv', data, callback)
  }

  commitNvs (commonInfo, nvs, callback = () => {
  }) {
    const data = {
      commonInfo: commonInfo,
      value: nvs
    }
    return this.remoteCall('/nv/commitNvs', data, callback)
  }

  deleteNvById (commonInfo, ndCode, nvId, callback = () => {
  }) {
    const data = {
      commonInfo: commonInfo,
      value: {
        nvId,
        ndCode
      }
    }
    return this.remoteCall('/nv/deleteNv', data, callback)
  }

  copyNv (commonInfo, ndCode, nvId, callback = () => {
  }) {
    const data = {
      commonInfo: commonInfo,
      value: {
        nvId,
        ndCode
      }
    }
    return this.remoteCall('/nv/copyNv', data, callback)
  }

  getParentNvIdCodeAndNdCode (commonInfo, ndCode, parentNvCode, codeFdName, callback = () => {
  }) {
    const data = {
      commonInfo: commonInfo,
      value: {
        code: parentNvCode,
        ndCode,
        codeFdName: codeFdName
      }
    }
    return this.remoteCall('/nv/getParentNvIdCodeAndNdCode', data, callback)
  }
}

const nvService = new NvService(false)
export const nvServiceSilent = new NvService(true);
export default nvService
